package com.ghpt.controller;
import com.ghpt.pojo.DiRe;
import com.ghpt.service.DiReService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@RestController
@RequestMapping("/dire")
public class DiReController {
    private final DiReService diReService;

    public DiReController(DiReService diReService) {
        this.diReService = diReService;
    }
    @GetMapping("/{id}")
    public DiRe getDiReById(@PathVariable Long id) {
        System.out.println("结果是"+diReService.findDiReById(id));
        return diReService.findDiReById(id);
    }
    @PutMapping
    public int updateDiRe(@RequestBody DiRe diRe) {
        return diReService.updateById(diRe);
    }

}
